package com.sky.chapter1.threadCreate;

import lombok.SneakyThrows;

/**
 * @author : wushikai
 * <p>
 * date : 2021-03-20
 * <p>
 * idea 线程照相机
 */
class MyThread extends Thread {

    @SneakyThrows
    @Override
    public void run() {
        System.out.println(this.getName() + " --> 启动");
        for (int i = 0; i < 10; i++) {

            Thread.sleep(1000);
        }
    }


    public static void main(String[] args) {


        MyThread thread = new MyThread();


        thread.setName("caonima");
        thread.start();


        for (int i = 0; i < 5; i++) {

            MyThread myThread = new MyThread();
            myThread.setName("线程" + i);
            myThread.start();
        }
    }

}
